<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>高度塌陷</title>
</head>
<body>
    <!-- 高度塌陷问题，父元素的第一个子元素设置margin-top,最后一个子元素设置margin-bottem,会被父元素抢走 -->
    <!-- 解决方案1 给外层父元素加上border -->
    <!-- 解决方案2 给外层父元素加上padding 1px -->
    <!-- 解决方案3 overflow:hidden -->
    <div class="outer">
        <div class="inner1">
          inner1
        </div>
        <div class="inner2">
          inner2
        </div>
    </div>
    <style>
        .outer{
            width: 400px;
            height: 400px;
            background-color: gray;
            /* border: solid; */
            /* padding: 1px; */
            overflow: hidden;
        }
        .inner1{
            width: 100px;
            height: 100px;
            background-color: red;
            /* 下面这行代码有问题，父元素的往下走了 */
            margin-top: 50px;
        }
        .inner2{
            width: 100px;
            height: 100px;
            background-color: blue;
        }
    </style>
</body>
</html>